package com.base.search.impl;



public class Test {

    public boolean isThree(int n) {
        if (n==1){
            return false;
        }
        int sqrt = (int)Math.sqrt(n);
        if (sqrt*sqrt==n&&isPrime(sqrt)){
            return true;
        }

        return false;

    }

    public boolean isPrime(int n){
        int sqrt = (int)Math.sqrt(n);
        for (int i = 2; i < sqrt; i++) {
            if (n%i==0){
                return false;
            }
        }
        return true;

    }

    public long minimumPerimeter(long neededApples) {
            long i=0,tmp=0;
            while (true){
                i++;
                for (int j=1;j<=i;j++){
                    tmp+=(j+i)*8;
                }
                tmp+=i*4;
                if (tmp>=neededApples){
                    break;
                }
            }
            return i*2*4;
    }
    public static void main(String[] args) {
        BinarySearch search = new BinarySearch();
        int[] list={1,2,2,2,2,2,4};
        System.out.println(search.search_insert(list,3));

    }
}
